package com.lxh.baselibray.net;

import android.widget.Toast;

import com.lxh.baselibray.BaseApplication;
import com.lxh.baselibray.util.ToastUtils;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public abstract class NetCallBack<T> implements Callback<T>{
    @Override
    public void onResponse(Call<T> call, Response<T> response) {
        if (response!=null&& response.body() !=null&&response.isSuccessful()){
            onSuccess( call, response);
        }else {
            onFailed();
        }
    }

    @Override
    public void onFailure(Call<T> call, Throwable t) {
        onFailed();
    }

    public abstract void onSuccess(Call<T> call,Response<T> response);
    public abstract void onFailed();
}
